package ldh.fx.adminfx.controller;

import com.jfoenix.controls.JFXButton;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.TableView;
import javafx.scene.layout.Pane;
import ldh.fx.adminfx.commpont.LPane;
import ldh.fx.adminfx.commpont.grid.NoHeaderTableView;
import ldh.fx.adminfx.pojo.Log;

import java.net.URL;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;

public class CustomerDetailController implements Initializable {

    @FXML private Pane root;
    @FXML private TableView<Log> logTable;

    @Override
    public void initialize(URL url, ResourceBundle resourceBundle) {
        logTable.getItems().addAll(loadLogs());
    }

    private List<Log> loadLogs() {
        List<Log> logs = new ArrayList();
        for(int i=0; i<8; i++) {
            Log log = new Log();
            log.setStatus("200");
            log.setMethod("Post");
            log.setPath("/v1/invoices/in_1Dnkhadfk");
            log.setDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
            logs.add(log);
        }
        return logs;
    }
}
